package org.example;

import org.example.config.AsyncThreadPoolConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.scheduling.annotation.EnableAsync;

/**
 * @author ${USER}
 * @date ${DATE} ${TIME}
 */
@EnableAsync
@SpringBootApplication
public class Main {
    public static void main(String[] args) {
        SpringApplication.run(Main.class, args);
    }



    /**
     * 自定义Async线程池
     *
     * @return AsyncTaskExecutor
     */
    @Bean
    public AsyncTaskExecutor taskExecutor() {
        return new AsyncThreadPoolConfig(20, 50, 500, 10,
                "async-webHireKfc-thread-pool").getThreadPool();
    }
}